First-order function dispatch in a Java-like programming language

نویسنده

  • Steven te Brinke
چکیده

Glossary 185 Bibliography 186 Contents iv 1 Introduction 1.1. Goals and motivation Separation of concerns is an important concept in software development. Every software application consists of multiple concerns, examples are: what is to be computed, how the results are displayed, who is authorized to view the results, which data is logged, etc. Separation of these concerns allows a programmer to focus on a single concern, without having to consider everything at once [10]. During the software life cycle, concerns often evolve separately. Therefore, evolution scenarios are better supported when concerns are separated. To separate concerns, software is typically decomposed in separate parts, called modules [6]. These modules are integrated in a coherent program by using composition operators. Composition operators are the language mechanisms which let programmers compose behaviour and/or data, defined as separate entities. Examples of composition operators are: function application, inheritance, delegation, pointcut-advice mechanisms, composition filters, etc. Function application allows the invo-cation of functionality defined separately—as a function definition—by using a call statement. Inheritance and delegation allow addressing fields and methods defined separately—as part of a super class or delegatee. Depending on the situation, different composition operators are needed, but no language provides all possible relevant operators. When a language does not provide a composition operator with the desired compositional behaviour, workarounds have to be used by the programmer. That is, introducing new operators by writing glue code, for example as macros, libraries, frameworks or language extensions. Often, these newly introduced operators are only partially integrated with the language. Therefore, its use might require additional glue code to be written, of which an example is given in the next paragraph. Typically, such glue code solutions suffer from a lack of maintainability. As shown in [16], delegation is a composition operator that requires additional glue code when explicit language support is lacking. In object-oriented languages that do not support explicit delegation [25], similar functionality can be simulated by 1 Introduction 2 forwarding calls from one object to another. However, when forwarding a call in this way, the self or this object context changes from the object the call was originally sent to—the interface object—to the object to which the call is delegated. In contrast, in languages that support explicit delegation, the self context does not change when delegating an operation. This difference leads to the so-called self problem in languages that do not support explicit delegation [25]. That is, …

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

VAlloy - Virtual Functions Meet a Relational Language

We propose VAlloy, an extension to the first order, relational language Alloy. Alloy is suitable for modeling structural properties of object-oriented software. However, Alloy lacks support for dynamic dispatch, i.e., function invocation based on actual parameter types. VAlloy introduces virtual functions in Alloy, which enables intuitive modeling of inheritance. Models in VAlloy are automatica...

متن کامل

Implementing Run-time Support for Components using Object-Oriented Programming

ions That Guide Component Implementation We implement components by trying to be first of all good designers and secondly by following the Java Beans “design pattern” conventions. In this way we can benefit from the powerful introspection mechanism of Java Beans. [2] Identifies three technical features that need to be supported by component-oriented programming: component containment, multiple ...

متن کامل

Functional Adaptive Programming with DemeterF

In this paper we present a new functional traversal abstraction for processing OO data structures that decomposes traversal computation into three function objects and a traversal control function. Function objects compute and combine values over a general traversal while the control function allows programmers to limit the extent of a traversal. Our new abstraction is supported by a Java libra...

متن کامل

When separation logic met Java (by example)

Separation logic is a promising new approach to modular reasoning, but so far it has primarily been applied to low-level C-like languages. To extend separation logic to allow modular reasoning about object-oriented languages like Java, we must add behavioural subtyping to the logic. However, a naı̈ve integration of behavioural subtyping and separation logic is too restrictive. In this paper we d...

متن کامل

Multi-Dispatch in the Java Virtual Machine: Design and Implementation

Mainstream object-oriented languages, such as C++ and Java1, provide only a restricted form of polymorphic methods, namely uni-receiver dispatch. In common programming situations, developers must work around this limitation. We describe how to extend the Java Virtual Machine to support multi-dispatch and examine the complications that Java imposes on multidispatch in practice. Our technique avo...

متن کامل

Macros That Play: Migrating from Java to Maya

Maya is a version of Java that allows users to write their own syntax extensions, which are called Mayans. Mayans can reinterpret or extend Maya syntax by expanding it to other Maya syntax: they operate on abstract syntax trees, and their expansion is triggered during parsing as semantic actions. Maya’s expressiveness comes from treating grammar productions as generic functions, and Mayans as m...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2011